package com.jjyu.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
import com.baomidou.mybatisplus.extension.kotlin.KtQueryChainWrapper;
import com.baomidou.mybatisplus.extension.kotlin.KtUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jjyu.dao.PointsLogMapper;
import com.jjyu.entity.OrderItem;
import com.jjyu.entity.PointsLog;
import com.jjyu.service.PointsLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;

@Service
public class PointsLogServiceImpl extends ServiceImpl<PointsLogMapper, PointsLog> implements PointsLogService {

    @Autowired
    private PointsLogMapper pointsLogMapper;

    @Override
    public List<PointsLog> getAllPointsLog() {
        return list();
    }

    @Override
    public List<PointsLog> getPointsLogByUserId(Integer userId) {
        return lambdaQuery().eq(PointsLog::getUserId, userId).list();
    }

    @Override
    public List<PointsLog> getPointsLogByOrderId(Integer orderId) {
        return lambdaQuery().eq(PointsLog::getOrderId, orderId).list();
    }

    @Override
    public List<PointsLog> getPointsLogByPage(int pageNum, int pageSize) {
        return List.of();
    }

    @Override
    public Integer getTotalPointsByUserId(Integer userId) {
        // 使用自定义的 MyBatis 映射方法来获取用户总积分
        return pointsLogMapper.selectTotalPointsByUserId(userId);
    }

    @Override
    public int insertPointsLogFromOrderItem(Integer userId, Integer pointsEarned, OrderItem orderItem) {
        // 使用自定义的 MyBatis 映射方法来插入新的积分日志记录
        return pointsLogMapper.insertPointsLogFromOrderItem(userId, pointsEarned, orderItem);
    }

    @Override
    public boolean save(PointsLog entity) {
        return super.save(entity);
    }

    @Override
    public boolean saveBatch(Collection<PointsLog> entityList) {
        return super.saveBatch(entityList);
    }

    @Override
    public boolean saveOrUpdateBatch(Collection<PointsLog> entityList) {
        return super.saveOrUpdateBatch(entityList);
    }

    @Override
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

    @Override
    public boolean removeById(PointsLog entity) {
        return super.removeById(entity);
    }

    @Override
    public boolean removeByMap(Map<String, Object> columnMap) {
        return super.removeByMap(columnMap);
    }

    @Override
    public boolean remove(Wrapper<PointsLog> queryWrapper) {
        return super.remove(queryWrapper);
    }

    @Override
    public boolean removeByIds(Collection<?> list) {
        return super.removeByIds(list);
    }

    @Override
    public boolean removeByIds(Collection<?> list, boolean useFill) {
        return super.removeByIds(list, useFill);
    }

    @Override
    public boolean removeBatchByIds(Collection<?> list) {
        return super.removeBatchByIds(list);
    }

    @Override
    public boolean removeBatchByIds(Collection<?> list, boolean useFill) {
        return super.removeBatchByIds(list, useFill);
    }

    @Override
    public boolean updateById(PointsLog entity) {
        return super.updateById(entity);
    }

    @Override
    public boolean update(Wrapper<PointsLog> updateWrapper) {
        return super.update(updateWrapper);
    }

    @Override
    public boolean update(PointsLog entity, Wrapper<PointsLog> updateWrapper) {
        return super.update(entity, updateWrapper);
    }

    @Override
    public boolean updateBatchById(Collection<PointsLog> entityList) {
        return super.updateBatchById(entityList);
    }

    @Override
    public PointsLog getById(Serializable id) {
        return super.getById(id);
    }

    @Override
    public Optional<PointsLog> getOptById(Serializable id) {
        return super.getOptById(id);
    }

    @Override
    public List<PointsLog> listByIds(Collection<? extends Serializable> idList) {
        return super.listByIds(idList);
    }

    @Override
    public List<PointsLog> listByMap(Map<String, Object> columnMap) {
        return super.listByMap(columnMap);
    }

    @Override
    public PointsLog getOne(Wrapper<PointsLog> queryWrapper) {
        return super.getOne(queryWrapper);
    }

    @Override
    public Optional<PointsLog> getOneOpt(Wrapper<PointsLog> queryWrapper) {
        return super.getOneOpt(queryWrapper);
    }

    @Override
    public boolean exists(Wrapper<PointsLog> queryWrapper) {
        return super.exists(queryWrapper);
    }

    @Override
    public long count() {
        return super.count();
    }

    @Override
    public long count(Wrapper<PointsLog> queryWrapper) {
        return super.count(queryWrapper);
    }

    @Override
    public List<PointsLog> list(Wrapper<PointsLog> queryWrapper) {
        return super.list(queryWrapper);
    }

    @Override
    public List<PointsLog> list(IPage<PointsLog> page, Wrapper<PointsLog> queryWrapper) {
        return super.list(page, queryWrapper);
    }

    @Override
    public List<PointsLog> list() {
        return super.list();
    }

    @Override
    public List<PointsLog> list(IPage<PointsLog> page) {
        return super.list(page);
    }

    @Override
    public <E extends IPage<PointsLog>> E page(E page, Wrapper<PointsLog> queryWrapper) {
        return super.page(page, queryWrapper);
    }

    @Override
    public <E extends IPage<PointsLog>> E page(E page) {
        return super.page(page);
    }

    @Override
    public List<Map<String, Object>> listMaps(Wrapper<PointsLog> queryWrapper) {
        return super.listMaps(queryWrapper);
    }

    @Override
    public List<Map<String, Object>> listMaps(IPage<? extends Map<String, Object>> page, Wrapper<PointsLog> queryWrapper) {
        return super.listMaps(page, queryWrapper);
    }

    @Override
    public List<Map<String, Object>> listMaps() {
        return super.listMaps();
    }

    @Override
    public List<Map<String, Object>> listMaps(IPage<? extends Map<String, Object>> page) {
        return super.listMaps(page);
    }

    @Override
    public <E> List<E> listObjs() {
        return super.listObjs();
    }

    @Override
    public <V> List<V> listObjs(Function<? super Object, V> mapper) {
        return super.listObjs(mapper);
    }

    @Override
    public <E> List<E> listObjs(Wrapper<PointsLog> queryWrapper) {
        return super.listObjs(queryWrapper);
    }

    @Override
    public <V> List<V> listObjs(Wrapper<PointsLog> queryWrapper, Function<? super Object, V> mapper) {
        return super.listObjs(queryWrapper, mapper);
    }

    @Override
    public <E extends IPage<Map<String, Object>>> E pageMaps(E page, Wrapper<PointsLog> queryWrapper) {
        return super.pageMaps(page, queryWrapper);
    }

    @Override
    public <E extends IPage<Map<String, Object>>> E pageMaps(E page) {
        return super.pageMaps(page);
    }

    @Override
    public QueryChainWrapper<PointsLog> query() {
        return super.query();
    }

    @Override
    public LambdaQueryChainWrapper<PointsLog> lambdaQuery() {
        return super.lambdaQuery();
    }

    @Override
    public LambdaQueryChainWrapper<PointsLog> lambdaQuery(PointsLog entity) {
        return super.lambdaQuery(entity);
    }

    @Override
    public KtQueryChainWrapper<PointsLog> ktQuery() {
        return super.ktQuery();
    }

    @Override
    public KtUpdateChainWrapper<PointsLog> ktUpdate() {
        return super.ktUpdate();
    }

    @Override
    public UpdateChainWrapper<PointsLog> update() {
        return super.update();
    }

    @Override
    public LambdaUpdateChainWrapper<PointsLog> lambdaUpdate() {
        return super.lambdaUpdate();
    }

    @Override
    public boolean saveOrUpdate(PointsLog entity, Wrapper<PointsLog> updateWrapper) {
        return super.saveOrUpdate(entity, updateWrapper);
    }

    // 其他服务方法...
}
